//
//  ParticleEmitter.h
//  Void Dead
//
//  Created by Sidney Just on 12.09.09.
//  Copyright 2009 Sidney Just
//  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; 
//  either version 3 of the License, or (at your option) any later version.
//  
//  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
//  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//  

#import <Foundation/Foundation.h>

@class VD_PanelManager;
@class VD_Particle;
@class VD_Engine;

/**
 * This class represents a particle emitter
 * It will spawn particles as long as it exists!
 **/
@interface VD_ParticleEmitter : NSObject {
	VD_PanelManager *panMan;
	
	int maxParticles;
	
	VD_Particle **particles;
	int currParticles;
	
	VD_Engine *ccEngine;
	
	int texWidth;
	int texHeight;
	
	int gainSize_x;
	int gainSize_y;
	
	int pos_x;
	int pos_y;
	
	int gain_X;
	int gain_Y;
	
	int texture;
	int layer;
	
	int randomX;
	int randomY;
	
	int gravityX;
	int gravityY;
	
	float lifespan;
	
	float globalLifespan;
	float glifespan;
	
	BOOL bright;
	
	int spawnPerFrame;
}

/**
 * The lifespan of this emmiter. Ist this set to a value greater than 0 the emitter will spawn particles and release itself after the gloablLifespan time is expired
 **/
@property float globalLifespan;

/**
 * YES = The Alpha value of the particles will be blended over the background. NO = The Alpha value of the particles will be mixed with the background
 * Default: NO
 **/
@property BOOL bright;

/**
 * This value will be added to the x position of a particle every frame!
 **/
@property int gain_X;

/**
 * This value will be added to the y position of a particle every frame!
 **/
@property int gain_Y;

/**
 * This value will be added to the x size of a particle every frame!
 **/
@property int gainSize_x;

/**
 * This value will be added to the y size of a particle every frame!
 **/
@property int gainSize_y;

/**
 * This x position of the emitter.
 **/
@property int pos_x;

/**
 * This y position of the emitter.
 **/
@property int pos_y;

/**
 * This value will be added every frame to the force_x value of a particle.
 **/
@property int gravityX;

/**
 * This value will be added every frame to the force_y value of a particle.
 **/
@property int gravityY;

/**
 * A random value between -randomX and randomX will be added every frame to the position of a particle. The random value is different vor every particle
 **/
@property int randomX;

/**
 * A random value between -randomY and randomY will be added every frame to the position of a particle. The random value is different vor every particle
 **/
@property int randomY;

/**
 * The layer of the particles
 **/
@property int layer;

/**
 * The max amount of particles
 **/
@property int maxParticles;

/**
 * The amount of particles that will be spawned per frame
 **/
@property int spawnPerFrame;

/**
 * The lifespan in seconds of a particle. After this time, the particle will "die"
 **/
@property float lifespan;

- (id)initWithEngine:(VD_Engine *)engine;

/**
 * Sets the particle texture. Without texture, there will be no particle spawned!
 **/
- (void)setTexture:(int)tex;

- (void)spawnParticles;

@end
